package com.jubotech.business.web.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jubotech.business.web.dao.WxMessageDao;
import com.jubotech.business.web.domain.WxMessageInfo;

@Service
@Transactional // 支持事务
public class WxMessageService {

	@Autowired
	private WxMessageDao weChatMessageDao;
 
	public WxMessageInfo queryWeChatMessageInfoByMsgServerId(String wechatid, String friendid, String msgSvrId) {
		return weChatMessageDao.queryWeChatMessageInfoByMsgServerId(wechatid, friendid, msgSvrId);
	}
	
	public void update(WxMessageInfo info) {
		try {
			weChatMessageDao.update(info);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	
	public void insert(WxMessageInfo info) {
		try {
			weChatMessageDao.insert(info);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void delete(Integer id) {
		WxMessageInfo info = new WxMessageInfo();
		info.setId(id);
		weChatMessageDao.delete(info);
	}

}
